# -*- coding: gbk -*-


def checkConfig(conf):
    DMALEN_flag = False
    if conf.get('toDma') is not None and conf.get('toDmaLen') is None:
        DMALEN_flag = True
        conf['toDmaLen'] = f'{conf["FName"]}.dmaLen'
    conf = {
        'AIS': False,
        'DMA': conf.get('toDma') is not None,
        'DMALEN': DMALEN_flag,
        **conf,
    }
    if conf.get('ArrayName') is None:
        conf['AIS'] = True
        conf['ArrayName'] = (conf['FName']) + '.array'
    if conf.get('toDma') is not None:
        conf['toDma'] = conf['toDma'].format(buf='ptr', len=f"&{conf['toDmaLen']}").format(**conf).strip(';')
    return conf
